Received: by 10.223.164.221 with SMTP id h29csp399884wrb; Fri, 3 Nov 2017 17:18:50 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SdkitmBUnW8G4dYbpZy0gqRKKY+1Oq9xokEU8JWQGJ4aKMoHuMuS8R1c+UsFsGLXhAbNEN X-Received: by 10.98.156.207 with SMTP id u76mr9273510pfk.211.1509754730466; Fri, 03 Nov 2017 17:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509754730; cv=none; d=google.com; s=arc-20160816; b=LNiIKDNRAGsbZkQ81pGib2LivgCbZJ+4z6dfLmhLLsXURmbk+OtBxjkZkfWUbfFZiW gkAZn4Abbg3gxodaV4mNlIEZOws/6Shei//4MWLlSuBnkl/Hl4B5eol7OaTraO17XRVm Y2LpY+DHf4xUBeNlThWKMtn8GXyUXuYnqtFFSuZXDOxK3E2NU+KVB0CRpMubpVJ38yJP NWpiIck1k6smI/YDZgLVndUzS5/CjuO/EkDrzMPW+Q3uVsqp1uHBtdWBV/kLQQL2z+gc woLpOi1XT1SXP1Rs26GMLyCLTFiQDlVTcy84zSkslxoxxu60AKdKu0k61iGvyJgcKHS1 me5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=GXL3WilsjApge/7rgknFKyZeCQqdwuQcJ2hdGglwoGE=; b=FJ1sXMtMKNar8IwkVQWX/WbO4PjyyCEdVpibEOCgfxQgdD03nRXsxfLs4Kj/KTZ/WK yjKwwG3/Ud+huHp9lKscY34IZLfJU92pJaNDlf12urZZ6V4bEfqRkW0CcbjiDeBS+fKq h4U1Dh80eQU0Cp0kyIPbuFMzkOwMA7YpTPDgHOgRhFA4gqXLNk9nF+foTRIYtoMJtmT/ yHNoB88aFxVnuG3SuoVY790kcMKNlE/Pg8bvah9Cdr2TszZrQM1TFk0avQ1jtporLQIJ rr9qF1+l2iNK+iYJNeiOg67n2gSc1dNCejk6TDIShHNyZCQhi8o+aSMdFOExqbuviMWk J3Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gateworks-com.20150623.gappssmtp.com header.s=20150623 header.b=NSl28l12; 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 x5si5813548plm.625.2017.11.03.17.18.36; Fri, 03 Nov 2017 17:18:50 -0700 (PDT) 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=@gateworks-com.20150623.gappssmtp.com header.s=20150623 header.b=NSl28l12; 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 S1755830AbdKDASA (ORCPT + 92 others); Fri, 3 Nov 2017 20:18:00 -0400 Received: from mail-wr0-f172.google.com ([209.85.128.172]:49604 "EHLO mail-wr0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752458AbdKDAR5 (ORCPT ); Fri, 3 Nov 2017 20:17:57 -0400 Received: by mail-wr0-f172.google.com with SMTP id g90so3858461wrd.6 for ; Fri, 03 Nov 2017 17:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GXL3WilsjApge/7rgknFKyZeCQqdwuQcJ2hdGglwoGE=; b=NSl28l12si1TuyIV7ctcD6CjYiCa/BysD6GTrh20FlNYNiS3ZPZHybv9QEThB5zR0l 2yh1nGP0WOsYdEkXVwX/O+dM88GvRm0mMcrJXP5p3UBcrK5Ksaik5F6cVrDaQa4NunJa fzfsRmHV9Wr2TjmWglfoPOhdNJtSP6LvCjedAH7+uUlwCM20WPcFY+uBbcmcmIfJ30kI cbWkxMQUlZlLw2+MHPcrUeUUtNEVCPjeBI2ps+ZqAk6C2GVacyU2B8F6M7hjMd/I6lCR 8KHRTn4oqZI8qTglIfQDsOjyt9ZzpUQd2XAGXBqEUNRHWWx7eEGP6VBEREsEAV8WqFXA k1rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GXL3WilsjApge/7rgknFKyZeCQqdwuQcJ2hdGglwoGE=; b=V6zgQ1nHg8OF5cwQPcTn2Ow3AuKYkspNFQdC+m2NcBcC53MvxPOqzSFP7HUTAKrjjw B85KZfCMcqbaKZGMdMeqc6mYk/Jvv50o5y2coqxedhdmsL0VLCEte/cminegqGeodiOR bp1Vf8tvA9/TKU9WbpneeQC9/xqOkJwQ0FJ5LKADVfALFjVOuTNi3J3c5x2+fjvEbUaP soAVOLrU5pZ/N/X0vl+IETQHOlTa8ejToKLjIQG20WgidXrtGbUkzeyHK6qt/rgxAeZL ukjKhTK9uSBF34ymCHsHbGMkpCgLbcdXwriDIeNt/JolP9JSTIlzhNx5nz8LHMVFQyVe NP+A== X-Gm-Message-State: AMCzsaWj3lLcvk9ORy+JotGqH3lH5f6LV2v8AhDkw5spQyDtJaGmbx/Z lE979FsXcSfG177bIZji4/a0T43b4EnOtD5Zg9C7Rg== X-Received: by 10.223.163.11 with SMTP id c11mr7082382wrb.102.1509754676254; Fri, 03 Nov 2017 17:17:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.228.215 with HTTP; Fri, 3 Nov 2017 17:17:55 -0700 (PDT) In-Reply-To: References: <1507783506-3884-1-git-send-email-tharvey@gateworks.com> <1507783506-3884-4-git-send-email-tharvey@gateworks.com> <230ceb18-1d69-7fa8-acb0-c810094f8e50@xs4all.nl> <5c68003a-380d-d339-718f-47bce64cdae8@xs4all.nl> From: Tim Harvey Date: Fri, 3 Nov 2017 17:17:55 -0700 Message-ID: Subject: Re: [PATCH v2 3/4] media: i2c: Add TDA1997x HDMI receiver driver To: Hans Verkuil Cc: linux-media , alsa-devel@alsa-project.org, "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Shawn Guo , Steve Longerbeam , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 23, 2017 at 10:05 AM, Tim Harvey wrote: > > On Fri, Oct 20, 2017 at 9:23 AM, Hans Verkuil wrote: > > >> > >> I see the AVI infoframe has hdmi_quantization_range and > >> hdmi_ycc_quantization_range along with vid_code. > >> > >> I'm not at all clear what to do with this information. Is there > >> anything you see in the datasheet [1] that points to something I need > >> to be doing? > > > > You can ignore hdmi_ycc_quantization_range, it is the hdmi_quantization_range > > that you need to read out. > > > > The TDA can receive the following formats: > > > > RGB Full Range > > RGB Limited Range > > YUV Bt.601 (aka SMPTE 170M) > > YUV Rec.709 > > > > The YUV formats are always limited range. > > > > The TDA can transmit RGB and YUV to the SoC. You want RGB to be full range and > > YUV to be limited range. YUV can be either 601 or 709. > > > > So if the TDA transmits RGB then you need to support the following conversions: > > > > RGB Full -> RGB Full > > RGB Limited -> RGB Full > > YUV 601 -> RGB Full > > YUV 709 -> RGB Full > > > > And if the TDA transmits YUV then you need these conversions: > > > > RGB Full -> YUV601 or YUV709 > > RGB Limited -> YUV601 or YUV709 > > YUV601 -> YUV601 > > YUV709 -> YUV709 > > > > For the RGB to YUV conversion you have a choice of converting to YUV601 or 709. > > I recommend to either always convert to YUV601 or to let it depend on the resolution > > (SDTV YUV601, HDTV YUV709). > > > > Ok - this is a good explanation that I should be able to follow. I > will make sure to take into account hdmi_quantization_range when I > setup the colorspace conversion matrix for v3. Hans, I'm having trouble figuring out the conversion matrix to use between limited and full. Currently I have the following conversion matrices, the values which came from some old vendor code: /* Colorspace conversion matrix coefficients and offsets */ struct color_matrix_coefs { /* Input offsets */ s16 offint1; s16 offint2; s16 offint3; /* Coeficients */ s16 p11coef; s16 p12coef; s16 p13coef; s16 p21coef; s16 p22coef; s16 p23coef; s16 p31coef; s16 p32coef; s16 p33coef; /* Output offsets */ s16 offout1; s16 offout2; s16 offout3; }; /* Conversion matrixes */ enum { ITU709_RGBLIMITED, ITU601_RGBLIMITED, RGBLIMITED_ITU601, }; static const struct color_matrix_coefs conv_matrix[] = { /* ITU709 -> RGBLimited */ { -256, -2048, -2048, 4096, -1875, -750, 4096, 6307, 0, 4096, 0, 7431, 256, 256, 256, }, /* YUV601 limited -> RGB limited */ { -256, -2048, -2048, 4096, -2860, -1378, 4096, 5615, 0, 4096, 0, 7097, 256, 256, 256, }, /* RGB limited -> ITU601 */ { -256, -256, -256, 2404, 1225, 467, -1754, 2095, -341, -1388, -707, 2095, 256, 2048, 2048, }, }; Assuming the above are correct this leaves me missing RGB limitted -> RGB full, YUV601 -> RGB full, YUV709 -> RGB full, and RGB Full -> YUV601. I don't have documentation for the registers but I'm assuming the input offset is applied first, then the multiplication by the coef, then the output offset is applied. I'm looking over https://en.wikipedia.org/wiki/YUV for colorspace conversion matrices but I'm unable to figure out how to apply those to the above. Any ideas? Thanks, Tim From 1582068841119851090@xxx Mon Oct 23 17:07:00 +0000 2017 X-GM-THRID: 1581025700141870942 X-Gmail-Labels: Inbox,Category Forums