Received: by 10.223.185.116 with SMTP id b49csp1985191wrg; Thu, 22 Feb 2018 06:28:05 -0800 (PST) X-Google-Smtp-Source: AH8x2248RcYS+W/R07q5Cdcm3PtGnv0Ie5v+q06esxb7IhjSqHfHPXTaUsbZEsHBU2IXLP8zYs61 X-Received: by 10.98.60.144 with SMTP id b16mr7145831pfk.61.1519309685824; Thu, 22 Feb 2018 06:28:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519309685; cv=none; d=google.com; s=arc-20160816; b=BNSRIAbGsOW9YAtZPB06AZGxPAxADbfg+WPOGaHI+ykPFOi8cqiNnc204D/QgM5IT7 U6AP1HvKSi+q57lCy0Frkex830f+WVQ18lQqPdR0LwmUDlWvhg+HXoxWW+vkvaV/Av92 VWpX32l55Nugz09Mi6icvQK1ukuF1XDInTgwxt0+OOeNGXnPWmPgkxXaFeU3ebxi/bei Qu3YeRO9O5Wbc7LJTWWAOM3q+mGmL7AK0tfNhsg7Aw4Zme3slD1F2qL8TC5hQL9ovMOs tLFvkX/DfBP26oAtBt9sOUj3kTCoPBbkBda/AYN3kGauyHQYS51BtHBuAmqO4xa4G+/6 oEYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=6uFM6N9OJKRtGbGPKy1Ma6g1fYFoZsHctPXiOdMcMF8=; b=JyvJLPUtMI6hAcxpnXqm3L3APlw5NZLpWA/peE8NNucuWXRk8NB5xMSc8qo5fybF+N xASWHlg6wEZg7uJsw7rstZ1eNn8JwwUfJv2Wy7hC68KY6mxPs4w2eWLjTMWZGWFDQ0M0 8gdF3LqJljrCTJL3yjcZjY3lwfU6oSvCaEL1XTYSvwgX100rBkr2evuYoIZgdq76WYNS IKXxaSb+zHAT/fio+A5Wu0Xxcsp8QuLQgxcjGN9dJ+hFVy/OoikEw/tuBRQStf9sa769 3Au/C5TXVdU2SO1c9hIlpU5IlZJtU99iEvRzqUH3ToH1hM4+zH05tUfUkApfRvtydWuk fYoQ== 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 y4si111964pfm.357.2018.02.22.06.27.51; Thu, 22 Feb 2018 06:28:05 -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; 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 S932937AbeBVO1A (ORCPT + 99 others); Thu, 22 Feb 2018 09:27:00 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:55309 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932692AbeBVO0z (ORCPT ); Thu, 22 Feb 2018 09:26:55 -0500 Received: from w540 (unknown [IPv6:2001:b07:6442:1ac4:3969:b0e2:8dc9:48c3]) (Authenticated sender: jacopo@jmondi.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B1D52C5A60; Thu, 22 Feb 2018 15:26:36 +0100 (CET) Date: Thu, 22 Feb 2018 15:26:35 +0100 From: jacopo mondi To: Laurent Pinchart Cc: Jacopo Mondi , magnus.damm@gmail.com, geert@glider.be, hverkuil@xs4all.nl, mchehab@kernel.org, festevam@gmail.com, sakari.ailus@iki.fi, robh+dt@kernel.org, mark.rutland@arm.com, pombredanne@nexb.com, linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org, linux-sh@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 11/11] media: i2c: ov7670: Fully set mbus frame fmt Message-ID: <20180222142635.GN7203@w540> References: <1519059584-30844-1-git-send-email-jacopo+renesas@jmondi.org> <2864762.IPlziE6Y0S@avalon> <20180222123600.GM7203@w540> <4525290.Vz7vJ24K7t@avalon> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4525290.Vz7vJ24K7t@avalon> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Laurent, On Thu, Feb 22, 2018 at 02:47:06PM +0200, Laurent Pinchart wrote: > Hi Jacopo, > > On Thursday, 22 February 2018 14:36:00 EET jacopo mondi wrote: > > On Thu, Feb 22, 2018 at 02:14:53PM +0200, Laurent Pinchart wrote: > > > On Thursday, 22 February 2018 14:04:12 EET jacopo mondi wrote: > > >> On Wed, Feb 21, 2018 at 10:28:06PM +0200, Laurent Pinchart wrote: > > >>> On Tuesday, 20 February 2018 10:58:57 EET jacopo mondi wrote: > > [snip] > > > >>>> This actually makes me wonder if those informations (ycbcb_enc, > > >>>> quantization and xfer_func) shouldn't actually be part of the > > >>>> supported format list... I blindly added those default fields in the > > >>>> try_fmt function, but I doubt they applies to all supported formats. > > >>>> > > >>>> Eg. the sensor supports YUYV as well as 2 RGB encodings (RGB444 and > > >>>> RGB 565) and 1 raw format (BGGR). I now have a question here: > > >>>> > > >>>> 1) ycbcr_enc transforms non-linear R'G'B' to Y'CbCr: does this > > >>>> applies to RGB and raw formats? I don't think so, and what value is > > >>>> the correct one for the ycbcr_enc field in this case? I assume > > >>>> xfer_func and quantization applies to all formats instead.. > > >>> > > >>> There's no encoding for RGB formats if I understand things correctly, > > >>> so I'd set ycbcr_enc to V4L2_YCBCR_ENC_DEFAULT. The transfer function > > >>> and the quantization apply to all formats, but I'd be surprised to find > > >>> a sensor outputting limited range for RGB. > > >> > > >> Ack, we got the same understanding for RGB formats. I wonder if for > > >> those formats we wouldn't need a V4L2_YCBCR_ENC_NONE or similar... > > > > > > That, or explicitly documenting that when the format is not YUV the field > > > should be set by both drivers and applications to V4L2_YCBCR_ENC_DEFAULT > > > when written and ignored when read. > > > > Well, if no encoding is performed because the color encoding scheme is > > RGB, the colorspace does anyway define an encoding method, so it seems > > to me the latter is more appropriate (use DEFAULT and ignore when read). > > > > That's anyway just my opinion, but I could send a patch for > > documentation and see what feedback it gets. > > > > >>> Have you been able to check whether the sensor outputs limited range > > >>> of full range YUV ? If it outputs full range you can hardcode > > >>> quantization to V4L2_QUANTIZATION_FULL_RANGE for all formats. > > >> > > >> In YUYV mode, I see values > 0xf0 ( > 240, which is the max value for > > >> CbCr samples in limited quantization range), so I assume quantization > > >> is full range. > > > > > > It should be, yes. What's the minimum and maximum values you get ? > > > > From a white surface: > > min = 0x39 > > max = 0xfc > > > > From a black surface: > > min = 0x00 (with 62 occurrences) > > max = 0x8b > > > > I guess that's indeed full range quantization > > Could you check Y and UV separately ? > > #!/usr/bin/python > > import sys > > def main(argv): > if len(argv) != 2: > print('Usage: %s ' % argv[0]) > return 1 > > data = open(argv[1], 'rb').read() > > y_min = 255 > y_max = 0 > uv_min = 255 > uv_max = 0 > > for i in range(len(data) // 2): > y = data[2*i] > uv = data[2*i] uv = data[2*i+1] > > y_min = min(y_min, y) > y_max = max(y_max, y) > uv_min = min(uv_min, uv) > uv_max = max(uv_max, uv) > > print('Y [%u, %u] UV [%u, %u]' % (y_min, y_max, uv_min, uv_max)) > return 0 > > if __name__ == '__main__': > sys.exit(main(sys.argv)) > White image: Y [57, 252] UV [105, 145] Black image: Y [0, 32] UV [116, 139]