Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1799007pxb; Wed, 9 Feb 2022 04:54:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyT13MihDaUL1g14BILEDghnDixSgBiUzU546UoMvHaPNZcU2a8DnPhxPJNQOPKrTQA/yXT X-Received: by 2002:a63:6a87:: with SMTP id f129mr1813729pgc.0.1644411260203; Wed, 09 Feb 2022 04:54:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644411260; cv=none; d=google.com; s=arc-20160816; b=jPLFD8T1ytQXhbtzGpX4iPMA0KnW6zOOBgAiJ/yrcPJNDFc/4YYLruQtxpoP6xQn4f kcuvYfO19gRlm5jEgIx7obq9Jd1k3P5DniK7bKSh2Lzy0sBOPps6UVvGACemU9R9A3P6 NFB9XYJmLhKZ2Tuc7rYUYJwijraGhKgB6Tl/Ha0d/vO2G9OR9raNuLrQsVEMtYyltEKt P57mli+zXo+7+dWOlozqCOfLYJ2HuAm6spAl6m4pFNyscL/8D3XsKX3t3Sh8afSDqNP/ RHEvVcKXSNfU7L4dkBvdcn3/KsOfPzMnTySoeKRY4qFMgNHt7sS7VZwShyAhciauYrRI ugmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=eDqbiVznXX4Rm3d2wj9/uhlkKynLY9fR9MPfADCdjPs=; b=V8o975SsTz/FDTzAzyrMknbIEYeGQKES1BNnXcnFaoJfu0ALlZNvQzOc3krOYnd3Kn 6EGk2hOLYp7eaxNU+HLYqtGIk2sZ9rgZ39mcA+yu5LUbIdQuDmFsA7MQZM7caYV+cA/M ZEyMc6sETJ7p3VjKOqico5+dhb8PRfmuV9HgPJoB73buGeKAzIEVGhXMuddeTZ0e7qmv tj8wF2ZtSJ4pmmLYClDeWNPAzDIPn3pqGRJkn25/0EiwIJxmisvGFihODCDagNPkvzUX kXQdxEx7CjetYNTyZCYeoUyj855aPrIiUpRV6c5/YaImcRbQ3FZSuNEWwiSQrBev/NJH fdOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e19si19377697pgl.818.2022.02.09.04.54.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 04:54:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DE3F9E13A34C; Wed, 9 Feb 2022 02:31:38 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240233AbiBIIBA (ORCPT + 99 others); Wed, 9 Feb 2022 03:01:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240377AbiBIIAu (ORCPT ); Wed, 9 Feb 2022 03:00:50 -0500 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D813C05CB95 for ; Wed, 9 Feb 2022 00:00:53 -0800 (PST) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 2197pbHw068866; Wed, 9 Feb 2022 15:51:37 +0800 (GMT-8) (envelope-from jammy_huang@aspeedtech.com) Received: from [192.168.2.115] (192.168.2.115) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 9 Feb 2022 15:59:49 +0800 Message-ID: Date: Wed, 9 Feb 2022 15:59:50 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v1] media: aspeed: Fix incorrect color Content-Language: en-US To: Paul Menzel CC: "eajames@linux.ibm.com" , "mchehab@kernel.org" , "joel@jms.id.au" , "andrew@aj.id.au" , "linux-media@vger.kernel.org" , "openbmc@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" , "linux-aspeed@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" References: <20220209024312.2218-1-jammy_huang@aspeedtech.com> <554448a9-bc65-7c0b-9878-fb2c0fe9bfe4@molgen.mpg.de> From: Jammy Huang In-Reply-To: <554448a9-bc65-7c0b-9878-fb2c0fe9bfe4@molgen.mpg.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [192.168.2.115] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 2197pbHw068866 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Paul, Thanks for your review and suggestion. On 2022/2/9 下午 02:23, Paul Menzel wrote: > Dear Jammy, > > > Am 09.02.22 um 03:43 schrieb Jammy Huang: >> Current settings for rgb-2-yuv is BT.601(studio swing), but JFIF >> uses BT.601(full swing). > Could you please describe the problem in a little more detail? On an > attached monitor to the BMC (which one) what incorrect colors are seen? Aspeed video 's input is gfx' output which is ARGB format. To generate jpg, video engine will transform ARGB into YUV first. Previously, aspeed video's default settings is studio swing (16~235), but jpg is full swing (0~255) as you can see in 'Conversion to and from RGB' of https://www.w3.org/Graphics/JPEG/jfif3.pdf. This will lead to incorrect color. For example, a RGB color on gfx, blue(0, 0, 255) will become (16, 16, 235) after we see the output jpg of aspeed video. > Maybe use: > >> media: aspeed: Use full swing for JFIF to fix incorrect color Thanks, I will update a more suitable subject for this patch. >> Signed-off-by: Jammy Huang >> --- >> drivers/media/platform/aspeed-video.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c >> index eb9c17ac0e14..08b63b8297f0 100644 >> --- a/drivers/media/platform/aspeed-video.c >> +++ b/drivers/media/platform/aspeed-video.c >> @@ -1089,7 +1089,7 @@ static void aspeed_video_init_regs(struct aspeed_video *video) >> u32 comp_ctrl = VE_COMP_CTRL_RSVD | >> FIELD_PREP(VE_COMP_CTRL_DCT_LUM, video->jpeg_quality) | >> FIELD_PREP(VE_COMP_CTRL_DCT_CHR, video->jpeg_quality | 0x10); >> - u32 ctrl = VE_CTRL_AUTO_OR_CURSOR; >> + u32 ctrl = VE_CTRL_AUTO_OR_CURSOR | VE_CTRL_YUV; > Excuse my ignorance, but reading [1][2] YUV can be represented by studio > and full swing. How is the register/bit described in the datasheet, and > can the macro name be improved? VR008[7:6] will decide the data format for video capture: 00: CCIR601 studio swing compliant YUV format 01: CCIR601 full swing compliant YUV format 10: RGB format 11: Gray color mode I will update this part as well. > >> u32 seq_ctrl = video->jpeg_mode; >> >> if (video->frame_rate) > > Kind regards, > > Paul > > > [1]: https://mymusing.co/bt601-yuv-to-rgb-conversion-color/ > [2]: https://www.hisour.com/yuv-color-system-25916/ -- Best Regards Jammy