Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2393851pxb; Wed, 9 Feb 2022 18:08:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMFRz8/scR5TVMGhXcBU9Umo3SQ/POHw0/xSf+OMJELmWy650rhTD8VkHsmE5clJ4jOz2Q X-Received: by 2002:a63:ed17:: with SMTP id d23mr4235475pgi.543.1644458914837; Wed, 09 Feb 2022 18:08:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644458914; cv=none; d=google.com; s=arc-20160816; b=FShd+RNMGTe9e8EMwZC8K1Gr168yMkaQg+n9TXE2QGcMtCxyR+UyRAze6J/EPk1KFz PUeE3FUQfkfgdCXLx3io7Ad4SVXyewQsachdMWsOqYW6CHGAtLoDNrX80WXmhnPIJt/W px9Gl22oKNr7CvU+srqO6HS+VwtNhCYevvGRK2bSd9wFY2iNv3bErkOwCR3hrFPeFD0c x7g1vQmDkPmh9sBjqmEsCRjB5KqdBUHwThsDSB5Snu+U/yIjqA89U/PjXFcupnYXlf2k mjkdu9mN9i2OASxMBDYeDBIjIMQQCiRt7eyKgEoO9rAusscQmGLx5CHuTYnEXJ5CMVoV ssAQ== 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=q9Su7COG3fxcbbtoXEyOxjRSNKaG/yIXTJgIQvZqtGI=; b=P7IkovpNm0YopFy7TqReyG2PD5bQwySvkziai0j8mCVb5eRAMCPIWLGWf0kQ2NDOhh G1kYRzSdtPQmakHnLcawzxZBfBHa6/JGnnH7oKkAN43/yeX+PA8Mv+X2DOUXdLBBTecD N3flulEpTv+j5bK+xWyR1cGsZ60nZLQyVg35y3k+y8m8W1vXGiz6/54eQZq7ti80Qpdz Fw0MSDBDC72pLVWNxBunAAQDjvShpNv8eGaeZAV7xyIOtjL3Ni27SLp3lbufbbpEv7tD NKwyVkXlzOJkyM94RDV4E5pOsw6Ig+YYRNMAMBnIjMXFABgeSYWTVibuvEPc7+VmAsGu 8YXA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l11si757698plg.35.2022.02.09.18.08.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 18:08:34 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 3BDCF237D7; Wed, 9 Feb 2022 18:05:41 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230151AbiBJCBD (ORCPT + 99 others); Wed, 9 Feb 2022 21:01:03 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:33916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233972AbiBJB77 (ORCPT ); Wed, 9 Feb 2022 20:59:59 -0500 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAED728CC1 for ; Wed, 9 Feb 2022 17:34:57 -0800 (PST) Received: from twspam01.aspeedtech.com (localhost [127.0.0.2] (may be forged)) by twspam01.aspeedtech.com with ESMTP id 21A0uWOt069631 for ; Thu, 10 Feb 2022 08:56:32 +0800 (GMT-8) (envelope-from jammy_huang@aspeedtech.com) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 21A0tKwB069583; Thu, 10 Feb 2022 08:55:20 +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; Thu, 10 Feb 2022 09:03:31 +0800 Message-ID: Date: Thu, 10 Feb 2022 09:03:35 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH v2] media: aspeed: Use full swing as JFIF to 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: <20220209084225.4456-1-jammy_huang@aspeedtech.com> From: Jammy Huang In-Reply-To: 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 21A0tKwB069583 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, OK, I will update a new patch per your suggestion. Thanks for your help. On 2022/2/9 下午 05:06, Paul Menzel wrote: > Dear Jammy, > > > Am 09.02.22 um 09:42 schrieb Jammy Huang: >> Current settings for video capture rgb-2-yuv is BT.601(studio swing), >> but JFIF uses BT.601(full swing) to deocde. This mismatch will lead >> to incorrect color. For example, input RGB value, (0, 0, 255), will >> become (16, 16, 235) after jpg decoded. >> >> Add an enum, aspeed_video_capture_format, to define VR008[7:6] >> capture format and correct default settings for video capture to fix >> the problem. > Maybe quote the datasheet: > > 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 > >> Signed-off-by: Jammy Huang >> --- >> v2: >> - update subject from 'media: aspeed: Fix-incorrect-color' to >> 'media: aspeed: Use full swing as JFIF to fix incorrect' >> - update commit message >> - add enum, aspeed_video_capture_format, to define VR008[7:6] >> --- >> drivers/media/platform/aspeed-video.c | 14 +++++++++++--- >> 1 file changed, 11 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c >> index eb9c17ac0e14..5bcf60b4628b 100644 >> --- a/drivers/media/platform/aspeed-video.c >> +++ b/drivers/media/platform/aspeed-video.c >> @@ -86,8 +86,6 @@ >> #define VE_CTRL_SOURCE BIT(2) >> #define VE_CTRL_INT_DE BIT(4) >> #define VE_CTRL_DIRECT_FETCH BIT(5) >> -#define VE_CTRL_YUV BIT(6) >> -#define VE_CTRL_RGB BIT(7) >> #define VE_CTRL_CAPTURE_FMT GENMASK(7, 6) >> #define VE_CTRL_AUTO_OR_CURSOR BIT(8) >> #define VE_CTRL_CLK_INVERSE BIT(11) >> @@ -202,6 +200,15 @@ enum { >> VIDEO_CLOCKS_ON, >> }; >> >> +// for VE_CTRL_CAPTURE_FMT >> +enum aspeed_video_capture_format { >> + VIDEO_CAP_FMT_YUV_STUDIO = 0, > Maybe also append `_SWING`? > >> + VIDEO_CAP_FMT_YUV_FULL, >> + VIDEO_CAP_FMT_RGB, >> + VIDEO_CAP_FMT_GRAY, >> + VIDEO_CAP_FMT_MAX >> +}; >> + >> struct aspeed_video_addr { >> unsigned int size; >> dma_addr_t dma; >> @@ -1089,7 +1096,8 @@ 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 | >> + FIELD_PREP(VE_CTRL_CAPTURE_FMT, VIDEO_CAP_FMT_YUV_FULL); >> u32 seq_ctrl = video->jpeg_mode; >> >> if (video->frame_rate) > Reviewed-by: Paul Menzel > > > Kind regards, > > Paul -- Best Regards Jammy